package com.example.spring_security_demo.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("/hello1")
    @PreAuthorize("@ex.hasAuthority('system:dept:hello1')")
//    @PreAuthorize("hasAnyAuthority ('admin','test','system:dept:list')")
//    @PreAuthorize("hasRole('system:dept:list')")
//    @PreAuthorize("hasAnyRole('admin','system:dept:list')")
//    @PreAuthorize("hasAuthority('system:dept:hello1')")
    public  String hello1(){
        return "hello1";
    }

    @GetMapping("/hello2")
    @PreAuthorize("hasAuthority('hello2')")
    public  String hello2(){
        return "hello2";
    }

}
